package com.chenyun.system.feign;

import com.chenyun.system.model.SysRole;
import com.chenyun.system.service.ISysRoleService;
import com.chenyun.common.vo.ServiceResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

/**
 * SysRoleClient：
 * Description:
 *
 * @author: Lonni
 * @date: 2023/3/31 0031 17:16
 */
@RestController
@Slf4j
public class SysRoleClient implements ISysRoleFeign {

    @Autowired
    private ISysRoleService roleService;

    /**
     * 添加角色
     *
     * @param role
     * @return 返回角色id
     */
    @Override
    public ServiceResponse<Long> addRole(SysRole role) {
        int i = roleService.insertRole(role);
        return i>0?ServiceResponse.fail("添加失败"):ServiceResponse.success(Long.valueOf(String.valueOf(i)));
    }
}



